package com.abing.observer.test2;

import com.abing.observer.test2.observer.EmailObServer;
import com.abing.observer.test2.observer.SmsObServer;
import com.abing.observer.test2.observer.WechatObServer;

import java.util.Observable;

public class Test2 {

    public static void main(String[] args) {

        // 1.创建具体的主题
        Observable observable = new MessageObServable();
        // 2. 注册观察者
        observable.addObserver(new EmailObServer());
        observable.addObserver(new SmsObServer());
        observable.addObserver(new WechatObServer());
        //发送消息
        observable.notifyObservers("恭喜您，下单成功！");
    }
}
